<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .outer, .left, .middle, .right {
            height: 100px;
        }
        .left {
            background: tomato;
        }
        .middle {
            background: lightgreen;
        }
        .right {
            background: gold;
        }
        /* 圣杯布局 通过浮动/负边距/定位实现 */
        .outer1 {
            padding: 0 200px 0 100px;
        }
        .outer1 .middle {
            width: 100%;
            float: left;
        }
        .outer1 .left {
            width: 100px;
            float: left;
            margin-left: -100%;
            position: relative;
            left: -100px;
        }
        .outer1 .right {
            width: 200px;
            float: left;
            margin-left: -200px;
            position: relative;
            left: 200px;
        }
        /* 双飞翼布局 通过浮动/负边距实现*/
        .outer2 .middle-wrapper {
            width: 100%;
            float: left;
        }
        .outer2 .middle {
            margin: 0 200px 0 100px;
        }
        .outer2 .left {
            width: 100px;
            float: left;
            margin-left: -100%;
        }
        .outer2 .right {
            width: 200px;
            float: left;
            margin-left: -200px;
        }
        /*定位布局*/
        .outer3 {
            position: relative;
        }
        .outer3 .middle {
            margin: 0 200px 0 100px;
        }
        .outer3 .left {
            width: 100px;
            position: absolute;
            left: 0;
            top: 0;
        }
        .outer3 .right {
            width: 200px;
            position: absolute;
            right: 0;
            top: 0;
        }
    </style>
</head>

<body>
<h2>三栏布局 左右固定 中间自适应</h2>

<!--middle必须大于left，否则回发生布局错乱-->
<h3>圣杯布局,源于<a href="http://alistapart.com/article/holygrail/">In Search of the Holy Grail</a></h3>
<div class="outer outer1">
    <div class="middle">圣杯-middle</div>
    <div class="left">圣杯-left</div>
    <div class="right">圣杯-right</div>
</div>

<h3>双飞翼布局,源于淘宝的UED</h3>
<div class="outer outer2">
    <div class="middle-wrapper">
        <div class="middle">双飞翼布局-middle</div>
    </div>
    <div class="left">双飞翼布局-left</div>
    <div class="right">双飞翼布局-right</div>
</div>

<h3>定位实现</h3>
<div class="outer outer3">
    <div class="middle">定位-middle</div>
    <div class="left">定位-left</div>
    <div class="right">定位-right</div>
</div>
</body>
</html>